package com.hsnn.medstgmini.sys.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.springframework.format.annotation.DateTimeFormat;

import com.hsnn.medstgmini.base.dict.model.DicArea;
import com.hsnn.medstgmini.base.dict.model.DicCompType;
import com.hsnn.medstgmini.base.std.model.CompClassify;
import com.hsnn.medstgmini.base.std.model.StdCompgroup;
import com.hsnn.medstgmini.util.DateUtil;
import com.hsnn.medstgmini.util.PinYin;

/**
 * @category 企业库
 * @author
 */
@Entity
@Table(name = "reg_compinfo")
public class RegCompInfo implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "comp_id")
	private String compId;

	@Column(name = "comp_code")
	private String compCode;

	@Column(name = "comp_name")
	private String compName;

	@Column(name = "comp_spel_code")
	private String compSpelCode;

	@Column(name = "comp_name_eng")
	private String compNameEng;
	
	@Column(name = "comp_short_name")
	private String compShortName;

	@Column(name = "comp_short_spel_code")
	private String compShortSpelSode;

	@Column(name = "comp_type")
	private String compType;

	@Transient
	private String compRegIdName;

	@Column(name = "org_code")
	private String orgCode;

	@OneToOne
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "comp_group_id", referencedColumnName = "comp_group_id")
	private StdCompgroup compGroupName;
	
//	@Column(name = "comp_group_id")
//	private String compGroupId;
//
//	@Transient
//	private String compGroupIdStr;
	
	public StdCompgroup getCompGroupName() {
		return compGroupName;
	}

	public void setCompGroupName(StdCompgroup compGroupName) {
		this.compGroupName = compGroupName;
	}

	@Column(name = "comp_phone")
	private String compPhone;

	@Column(name = "comp_address")
	private String compAddress;

	@Column(name = "comp_classify")
	private Integer compClassify;

	@Transient
	private String compClassifyName;

	@OneToOne
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "area_id", referencedColumnName = "area_id")
	private DicArea area;

	@Column(name = "biz_scope")
	private String bizScope;

	@Column(name = "reg_cap")
	private BigDecimal regCap;

	@Column(name = "comp_profile")
	private String compProfile;

	@Column(name = "legal_rep_name")
	private String legalRepName;

	@Column(name = "legal_rep_idnum")
	private String legalRepIdnum;

	@Column(name = "legal_rep_telephone")
	private String legalRepTelephone;

	@Column(name = "legal_rep_handphone")
	private String legalRepHandphone;

	@Column(name = "contact_name")
	private String contactName;

	@Column(name = "contact_idnum")
	private String contactIdnum;

	@Column(name = "contact_pos")
	private String contactPos;

	@Column(name = "contact_telephone")
	private String contactTelephone;

	@Column(name = "contact_handphone")
	private String contactHandphone;

	@Column(name = "contact_email")
	private String contactEmail;

	@Column(name = "contact_qq")
	private String contactQQ;

	@Column(name = "biz_lice_no")
	private String bizLiceNo;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "biz_lice_start_date")
	private Date bizLiceStartDate;

	@Transient
	private String bizLiceStartDateStr;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "biz_lice_end_date")
	private Date bizLiceEndDate;

	@Transient
	private String bizLiceEndDateStr;

	@Column(name = "tax_code")//税务登记号
	private String taxCode;

	@Column(name = "legal_rep_cert_code")
	private String legalRepCertCode;
	
	@Transient
	private String legalRepCertCodeStr;

	

	@Column(name = "indus_code")//生产经营证号
	private String indusCode;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "indus_code_start_date")
	private Date indusCodeStartDate;

	@Transient
	private String indusCodeStartDateStr;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "indus_code_end_date")
	private Date indusCodeEndDate;

	@Transient
	private String indusCodeEndDateStr;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "legal_rep_expire_date")
	private Date legalRepExpireDate;

	@Transient
	private String legalRepExpireDateStr;
	
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "legal_rep_expend_date")
	private Date legalRepExpendDate;


	@Transient
	private String legalRepExpendDateStr;
	
	@Column(name = "reg_datetime")
	private Date regDateTime;

	@Column(name = "audit_status")
	private Integer auditStatus;

	@Transient
	private String auditStatusName;

	@Column(name = "auditor")
	private String auditor;

	@Column(name = "audit_datetime")
	private Date auditDateTime;

	@Column(name = "audit_remark")
	private String auditRemark;
	
	@OneToOne
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "comp_reg_id", referencedColumnName = "comp_reg_id")
	private DicCompType compReg;

	public String getCompId() {
		return compId;
	}

	public void setCompId(String compId) {
		this.compId = compId;
	}

	public String getCompCode() {
		return compCode;
	}

	public void setCompCode(String compCode) {
		this.compCode = compCode;
	}

	public String getCompName() {
		return compName;
	}

	public void setCompName(String compName) {
		if(compName != null && !"".equals(compName)){
			compSpelCode = PinYin.getPinYinHeadChar(compName);
		}
		this.compName = compName;
	}

	public String getCompSpelCode() {
		return compSpelCode;
	}

	public void setCompSpelCode(String compSpelCode) {
		this.compSpelCode = compSpelCode;
	}

	public String getCompShortName() {
		return compShortName;
	}

	public void setCompShortName(String compShortName) {
		if(compShortName != null && !"".equals(compShortName)){
			compShortSpelSode = PinYin.getPinYinHeadChar(compShortName);
		}
		this.compShortName = compShortName;
	}

	public String getCompShortSpelSode() {
		return compShortSpelSode;
	}

	public void setCompShortSpelSode(String compShortSpelSode) {
		this.compShortSpelSode = compShortSpelSode;
	}

	public String getCompType() {
		return compType;
	}

	public void setCompType(String compType) {
		this.compType = compType;
	}

	public String getCompRegIdName() {
		return compRegIdName;
	}

	public void setCompRegIdName(String compRegIdName) {
		this.compRegIdName = compRegIdName;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

//	public String getCompGroupId() {
//		return compGroupId;
//	}
//
//	public void setCompGroupId(String compGroupId) {
//		this.compGroupId = compGroupId;
//	}
//
//	public String getCompGroupIdStr() {
//		return compGroupIdStr;
//	}
//
//	public void setCompGroupIdStr(String compGroupIdStr) {
//		this.compGroupIdStr = compGroupIdStr;
//	}
	
	public String getCompPhone() {
		return compPhone;
	}

	public void setCompPhone(String compPhone) {
		this.compPhone = compPhone;
	}

	public String getCompAddress() {
		return compAddress;
	}

	public void setCompAddress(String compAddress) {
		this.compAddress = compAddress;
	}

	public Integer getCompClassify() {
		return compClassify;
	}

	public void setCompClassify(Integer compClassify) {
		this.compClassify = compClassify;
	}

	public String getCompClassifyName() {
		if(compClassify !=null){
			compClassifyName = CompClassify.getName(compClassify);
		}
		return compClassifyName;
	}

	public void setCompClassifyName(String compClassifyName) {
		this.compClassifyName = compClassifyName;
	}

	public DicArea getArea() {
		return area;
	}

	public void setArea(DicArea area) {
		this.area = area;
	}

	public String getBizScope() {
		return bizScope;
	}

	public void setBizScope(String bizScope) {
		this.bizScope = bizScope;
	}

	public BigDecimal getRegCap() {
		return regCap;
	}

	public void setRegCap(BigDecimal regCap) {
		this.regCap = regCap;
	}

	public String getCompProfile() {
		return compProfile;
	}

	public void setCompProfile(String compProfile) {
		this.compProfile = compProfile;
	}

	public String getLegalRepName() {
		return legalRepName;
	}

	public void setLegalRepName(String legalRepName) {
		this.legalRepName = legalRepName;
	}

	public String getLegalRepIdnum() {
		return legalRepIdnum;
	}

	public void setLegalRepIdnum(String legalRepIdnum) {
		this.legalRepIdnum = legalRepIdnum;
	}

	public String getLegalRepTelephone() {
		return legalRepTelephone;
	}

	public void setLegalRepTelephone(String legalRepTelephone) {
		this.legalRepTelephone = legalRepTelephone;
	}

	public String getLegalRepHandphone() {
		return legalRepHandphone;
	}

	public void setLegalRepHandphone(String legalRepHandphone) {
		this.legalRepHandphone = legalRepHandphone;
	}

	public String getContactName() {
		return contactName;
	}

	public void setContactName(String contactName) {
		this.contactName = contactName;
	}

	public String getContactIdnum() {
		return contactIdnum;
	}

	public void setContactIdnum(String contactIdnum) {
		this.contactIdnum = contactIdnum;
	}

	public String getContactPos() {
		return contactPos;
	}

	public void setContactPos(String contactPos) {
		this.contactPos = contactPos;
	}

	public String getContactTelephone() {
		return contactTelephone;
	}

	public void setContactTelephone(String contactTelephone) {
		this.contactTelephone = contactTelephone;
	}

	public String getContactHandphone() {
		return contactHandphone;
	}

	public void setContactHandphone(String contactHandphone) {
		this.contactHandphone = contactHandphone;
	}

	public String getContactEmail() {
		return contactEmail;
	}

	public void setContactEmail(String contactEmail) {
		this.contactEmail = contactEmail;
	}

	public String getContactQQ() {
		return contactQQ;
	}

	public void setContactQQ(String contactQQ) {
		this.contactQQ = contactQQ;
	}

	public String getBizLiceNo() {
		return bizLiceNo;
	}

	public void setBizLiceNo(String bizLiceNo) {
		this.bizLiceNo = bizLiceNo;
	}

	public Date getBizLiceStartDate() {
		return bizLiceStartDate;
	}

	public void setBizLiceStartDate(Date bizLiceStartDate) {
		this.bizLiceStartDate = bizLiceStartDate;
	}

	public String getBizLiceStartDateStr() {
		if (bizLiceStartDate != null) {
			bizLiceStartDateStr = DateUtil.date(bizLiceStartDate);
		}
		return bizLiceStartDateStr;
	}

	public void setBizLiceStartDateStr(String bizLiceStartDateStr) {
		this.bizLiceStartDateStr = bizLiceStartDateStr;
	}

	public Date getBizLiceEndDate() {
		return bizLiceEndDate;
	}

	public void setBizLiceEndDate(Date bizLiceEndDate) {
		this.bizLiceEndDate = bizLiceEndDate;
	}

	public String getBizLiceEndDateStr() {
		if (bizLiceEndDate != null) {
			bizLiceEndDateStr = DateUtil.date(bizLiceEndDate);
		}
		return bizLiceEndDateStr;
	}

	public void setBizLiceEndDateStr(String bizLiceEndDateStr) {
		this.bizLiceEndDateStr = bizLiceEndDateStr;
	}

	public String getTaxCode() {
		return taxCode;
	}

	public void setTaxCode(String taxCode) {
		this.taxCode = taxCode;
	}

	public String getLegalRepCertCode() {
		return legalRepCertCode;
	}

	public void setLegalRepCertCode(String legalRepCertCode) {
		this.legalRepCertCode = legalRepCertCode;
	}

	public String getLegalRepCertCodeStr() {
		return legalRepCertCodeStr;
	}

	public void setLegalRepCertCodeStr(String legalRepCertCodeStr) {
		this.legalRepCertCodeStr = legalRepCertCodeStr;
	}
	
	
	public String getIndusCode() {
		return indusCode;
	}

	public void setIndusCode(String indusCode) {
		this.indusCode = indusCode;
	}

	public Date getIndusCodeStartDate() {
		return indusCodeStartDate;
	}

	public void setIndusCodeStartDate(Date indusCodeStartDate) {
		this.indusCodeStartDate = indusCodeStartDate;
	}

	public String getIndusCodeStartDateStr() {
		if (indusCodeStartDate != null) {
			indusCodeStartDateStr = DateUtil.date(indusCodeStartDate);
		}
		return indusCodeStartDateStr;
	}

	public void setIndusCodeStartDateStr(String indusCodeStartDateStr) {
		this.indusCodeStartDateStr = indusCodeStartDateStr;
	}

	public Date getIndusCodeEndDate() {
		return indusCodeEndDate;
	}

	public void setIndusCodeEndDate(Date indusCodeEndDate) {
		this.indusCodeEndDate = indusCodeEndDate;
	}

	public String getIndusCodeEndDateStr() {
		if (indusCodeEndDate != null) {
			indusCodeEndDateStr = DateUtil.date(indusCodeEndDate);
		}
		return indusCodeEndDateStr;
	}

	public void setIndusCodeEndDateStr(String indusCodeEndDateStr) {
		this.indusCodeEndDateStr = indusCodeEndDateStr;
	}

	public Date getLegalRepExpireDate() {
		return legalRepExpireDate;
	}

	public void setLegalRepExpireDate(Date legalRepExpireDate) {
		this.legalRepExpireDate = legalRepExpireDate;
	}

	public String getLegalRepExpireDateStr() {
		if (legalRepExpireDate != null) {
			legalRepExpireDateStr = DateUtil.date(legalRepExpireDate);
		}
		return legalRepExpireDateStr;
	}

	public void setLegalRepExpireDateStr(String legalRepExpireDateStr) {
		this.legalRepExpireDateStr = legalRepExpireDateStr;
	}

	public Date getRegDateTime() {
		return regDateTime;
	}

	public void setRegDateTime(Date regDateTime) {
		this.regDateTime = regDateTime;
	}

	public Integer getAuditStatus() {
		return auditStatus;
	}

	public void setAuditStatus(Integer auditStatus) {
		this.auditStatus = auditStatus;
	}

	public String getAuditStatusName() {
		if (auditStatus != null) {
			auditStatusName = AuditType.getName(auditStatus);
		}
		return auditStatusName;
	}

	public void setAuditStatusName(String auditStatusName) {
		this.auditStatusName = auditStatusName;
	}

	public String getAuditor() {
		return auditor;
	}

	public void setAuditor(String auditor) {
		this.auditor = auditor;
	}

	public Date getAuditDateTime() {
		return auditDateTime;
	}

	public void setAuditDateTime(Date auditDateTime) {
		this.auditDateTime = auditDateTime;
	}

	public String getAuditRemark() {
		return auditRemark;
	}

	public void setAuditRemark(String auditRemark) {
		this.auditRemark = auditRemark;
	}

	public DicCompType getCompReg() {
		return compReg; 
	}

	public void setCompReg(DicCompType compReg) {
		this.compReg = compReg;
	}
	public String getCompNameEng() {
		return compNameEng;
	}

	public void setCompNameEng(String compNameEng) {
//		if(compNameEng != null && !"".equals(compNameEng)){
//			compShortSpelSode = PinYin.getPinYinHeadChar(compNameEng);
//		}
		this.compNameEng = compNameEng;
	}

	public Date getLegalRepExpendDate() {
		return legalRepExpendDate;
	}

	public void setLegalRepExpendDate(Date legalRepExpendDate) {
		this.legalRepExpendDate = legalRepExpendDate;
	}

	public String getLegalRepExpendDateStr() {
		if (legalRepExpendDate != null) {
			legalRepExpendDateStr = DateUtil.date(legalRepExpendDate);
		}
		return legalRepExpendDateStr;
	}

	public void setLegalRepExpendDateStr(String legalRepExpendDateStr) {
		this.legalRepExpendDateStr = legalRepExpendDateStr;
	}
	
	
}
